package com.Algorithm.HUAWEI.one20211020;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/24/18:33
 * @Description:
 * @Target:
 */
public class 计算某字符出现次数 {
    public static void main(String[] args) throws Exception{
        BufferedReader bufferedReaderd = new BufferedReader(new InputStreamReader(System.in));
        String ss1 = bufferedReaderd.readLine();
        String ss2 = bufferedReaderd.readLine();
        int count = 0;

        for (int i = 0; i < ss1.length(); i++) {
            if (ss1.charAt(i)==ss2.charAt(0)||ss1.charAt(i)==(ss2.charAt(0)>'Z'?ss2.toUpperCase().charAt(0):ss2.toLowerCase().charAt(0))){
                count++;
            }
        }


        System.out.println(count);

    }
}
